<template>	<!-- 只能有一个子元素 -->
	<div>
		life
		<div>
			{{mycity}}
		</div>
		传递：
		<ul>
			<li v-for="(city,index) in list" :key="city.code" @click="naviTo(city)">{{city.name}}</li>
		</ul>
	</div>
</template>
<script>
	export default{
		data() {
			return{
				mycity:'',
				list:[{code:'010',name:"北京"},{code:'021',name:"上海"},{code:'030',name:"广州"},{code:'040',name:"深圳"}]
			}
		},
		mounted() {
			// this.mycity=this.$route.params.mycity //获取路由传参，路由:path:'/life/:mycity'
			// console.log(this.$route.params.mycity);
			console.log(this.$route) //获取路由传参
			// this.mycity=this.$route.query.myCityKey	//this.$router.push({path:'life',query:{myCityKey:v}})
			this.mycity=this.$route.params.myCityKey
		},
		methods:{
			naviTo(v){
				this.$router.push({name:'News',params:{myCityKeyIns:v}})
			}
		}
	}
</script>